package com.zhai.domain.award.service.distribute.impl;

import com.zhai.domain.award.model.entity.DistributeAwardEntity;
import com.zhai.domain.award.repository.IAwardRepository;
import com.zhai.domain.award.service.distribute.IDistributeAward;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.MathContext;

/**
 * @Description: 实物奖品发放服务
 * @ClassName: UserCreditRandomAward
 * @Author: zhaiyongxin
 * @Date: 2025/6/23 10:45
 * @Version: 1.0
 */
@Component("openai_use_count")
@Slf4j
public class RealAward_1 implements IDistributeAward {

    @Resource
    private IAwardRepository awardRepository;

    @Override
    public void giveOutPrizes(DistributeAwardEntity distributeAwardEntity) {
        log.info("进入实物奖品openai_use_count发放逻辑");


    }

    private BigDecimal generateRandom(BigDecimal min, BigDecimal max) {
        if (min.equals(max)) return min;
        BigDecimal randomBigDecimal = min.add(BigDecimal.valueOf(Math.random()).multiply(max.subtract(min)));
        return randomBigDecimal.round(new MathContext(3));
    }
}
